<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
function selectedType(){
	var obj = document.getElementById("selType");
	var selected = obj.selectedIndex;		//selectedIndex 메소드는 해당 option index번호 
	var selectedText = obj.options[selected].text;	// 선택된 인덱스 안에 text 값.
	
	return selectedText;		//text 값 리턴
}
function selectedIndex(){
	var obj = document.getElementById("selType");
	var selected = obj.selectedIndex;		//selectedIndex 메소드는 해당 option index번호 
	return selected;		// 인덱스 값 리턴
}

function preViewOpen(){
	var op=selectedIndex();		//인덱스 값 받아서 활용
	if(op==0){
		alert("값을 선택하세요.");
		return false;
	}
	window.open("/${initParam.context_root}/typeSevenPreView.do?selectType="+op, "preView",
			"width=700px, height=300px, menubar=no, status=yes, realzable=no, location=yes, scrollbars=no, toolbar=no, resizable=no");
}
function addSet(){
	alert('추가합니다.');
	var space = document.getElementById("plusSpace");
	var inputTitle = document.createElement("input");
	inputTitle.type = "text";
	inputTitle.name = "title";
	var inputLink = document.createElement("input");
	inputLink.setAttribute("type","text");
	inputLink.setAttribute("name","link");
	var inputImg = document.createElement("input");
	inputImg.setAttribute("type","text");
	inputImg.setAttribute("name","link");
	
	var txtTitle = document.createTextNode("타이틀 ");
	var txtLink = document.createTextNode("링크 ");
	var txtImg = document.createTextNode("이미지 ");
	
	var brTag = document.createElement("br");
	
	space.insertBefore(inputImg,space.firstChild);
	space.insertBefore(txtImg,space.firstChild);
	space.insertBefore(inputLink,space.firstChild);
	space.insertBefore(txtLink,space.firstChild);
	space.insertBefore(inputTitle,space.firstChild);
	space.insertBefore(txtTitle,space.firstChild);
	space.insertBefore(brTag,space.firstChild);
}

</script>
<title>배너관리포틀릿</title>
</head>
<body>
<table cellpadding="6px"  width="830px" border="1px"> 
	<tr>
		<td bgcolor="lightgray">제목
		</td>
		<td>제목
		</td>
	</tr>
	<tr>
		<td bgcolor="lightgray">설명
		</td>
		<td >설명
		</td>
	</tr>
	<tr>
		<td bgcolor="lightgray">타입선택
		</td>
		<td><select id="selType" name="selType" style="width: 250px">
				<option value="0">선택하세요</option>
				<option value="1">일반형(목록형)</option>
				<option value="2">전체이미지형</option>
				<option value="3">타입3</option>
		</select>
		&nbsp;&nbsp;
		<img alt="미리보기" src="/${initParam.context_root }/img/typeSeven/preView.png" style="cursor: pointer;"  onclick="preViewOpen()">
		</td>
	</tr>
	<tr>
		<td bgcolor="lightgray">설정
		</td>
		<td><img alt="추가" src="/${initParam.context_root }/img/typeSeven/plus.png" onclick="addSet()" style="cursor: pointer;">
			<span id="plusContents"> 
				타이틀<input type="text" name="">&nbsp;링크<input type="text" name="link">&nbsp;이미지<input type="text" name="image"> &nbsp; 
				<img alt="업로드" src="/${initParam.context_root }/img/typeSeven/upload.png" style="cursor: pointer;">
			</span>
			<span id="plusSpace"></span>
		</td>
	</tr>
</table>
<table width="830px">
	<tr>
		<td  align="right">
			<img alt="저장" src="/${initParam.context_root }/img/typeSeven/save.png" style="cursor: pointer;" onclick="location.href='/${initParam.context_root}/mainView.do'">&nbsp;&nbsp;
			<img alt="삭제" src="/${initParam.context_root }/img/typeSeven/delete.png" style="cursor: pointer;" onclick="location.href='/${initParam.context_root}/mainView.do'">&nbsp;&nbsp;
			<img alt="취소" src="/${initParam.context_root }/img/typeSeven/cancle.png" style="cursor: pointer;" onclick="location.href='/${initParam.context_root}/mainView.do'">&nbsp;&nbsp;
			<img alt="목록" src="/${initParam.context_root }/img/typeSeven/list.png" style="cursor: pointer;" onclick="location.href='/${initParam.context_root}/mainView.do'">&nbsp;&nbsp;
		</td>
	</tr>
</table>

</body>
</html>